<?php
class pollresultsAction extends security_normal {
	
	function action(){
		
		global $conn;
		$pollcategories=new model_Pollcategory();
		$pollcategories->setSubsection('WHERE isvisible=0 ORDER BY pollcategory_id DESC');
		$results=$pollcategories->doSelect();
		$pid=ceil($this->_getParamId(1));
		$pollcategory=new model_Pollcategory();
		$pollcategory->setSubsection('WHERE isvisible=0 AND pollcategory_id='.$pid);
		$PollCategoryRS=$pollcategory->doSelectOne();
		if(!$PollCategoryRS && $pid!=1){
			MessageBox('错误信息','back','对不起,您查看的投票不存在或已经被删除');
			exit;
		}

		if($pid!=1&&$PollCategoryRS->getIsopen()!=0){
			MessageBox('错误信息','back','对不起,此投票不允许查看投票结果');
			exit;
		}

		$smarty = new Smarty();
		$smarty->load_filter('pre','micePreCompileIndex');
		$smarty->assign('PollCategoryRS',$PollCategoryRS);
		$smarty->assign('results',$results);
		$smarty->assign("PollID",$pid);

		$filename = new getTPLFileName(__CLASS__);
		$tpl=$filename->TPLFileName;
		$smarty->display($tpl);
	}	
}
?>